#ifndef J3DGRAPH_BMD_JNT1_HEADER
#define J3DGRAPH_BMD_JNT1_HEADER

// this header needs
#include <stdio.h>
#include "../../J3DGRAPH.h"

// JNT1 section constants
#define J3DGRAPH_BMD_JNT1_POS 4

// j3dgraph_bmd_jnt1_err_cd enum
// enum with the possible codes a JNT1 section will present while analizing it
// errors codes are organized so fatal errors have less magnitude than the soft errors
typedef enum
{
  J3DGRAPH_BMD_JNT1_ERR_INV_STRUCT, // j3dgraph struct ptr is NULL/empty
  J3DGRAPH_BMD_JNT1_ERR_HEADER,     // section header is inconsistent
  
  J3DGRAPH_BMD_JNT1_ERR_NO_ERR,     // errors below this (in value) are fatal, above or equal are safe
  
  // ...
} j3dgraph_bmd_jnt1_err_cd;

// BMD JNT1 section (complete?)
// It is still unknown to me:
// - the rotation system in which the angles are expressed.
// - the tranformation matrix multiplication order.
// I assume the transformation values for each bone 
// are with respect to its parent joint reference system
typedef struct
{
  // my additions
  char * PATH;                      // file path
  ENDIAN_T ENDIAN;                  // endian
  j3dgraph_bmd_jnt1_err_cd ERR_CD;  // error code
  // actual structure
  byte * START;                     // 00 char[4]
  byte * SIZE;                      // 01 uint32
  byte * JNT_CNT;                   // 02 uint16
  byte * UNK_1;                     // 03 2 bytes
  byte * JNT_TRANSF_TB_OFFSET;      // 04 uint32
  byte * JNT_POS_TB_OFFSET;         // 05 uint32  
  byte * JNT_STR_TB_OFFSET;         // 06 uint32
  byte * JNT_TRANSF_TB;             // 07 JNT_COUNT * 64 bytes
  byte * JNT_POS_TB;                // 08 JNT_COUNT * 2 bytes
  byte * PAD_1;                     // 09 ?? (4 multiple address)
  j3dgraph_str_tb * JNT_STR_TB;     // 10 ??
  byte * PAD_2;                     // 11 ?? (32 multiple address)
} j3dgraph_bmd_jnt1;

// functions to check the information on the BMD JNT1 section
j3dgraph_bmd_jnt1_err_cd check_j3dgraph_bmd_jnt1(j3dgraph * file);

// append/remove/print the j3dgraph_bmd_jnt1
// structure to an incomplete j3dgraph structure
j3dgraph_bmd_jnt1 * append_j3dgraph_bmd_jnt1(j3dgraph * file);
void remove_j3dgraph_bmd_jnt1(j3dgraph * file);
void print_j3dgraph_bmd_jnt1(j3dgraph_bmd_jnt1 * jnt1);

#include "JNT1.c"

#endif // J3DGRAPH_BMD_JNT1_HEADER
